package cz.muni.fi.pa165.hauntedhouses.dao;

import cz.muni.fi.pa165.hauntedhouses.dto.AbilityType;
import cz.muni.fi.pa165.hauntedhouses.entity.Ghost;
import cz.muni.fi.pa165.hauntedhouses.entity.House;
import java.util.List;

/**
 *
 * @author Petr Suchý (373947)
 */
public interface GhostDAO {
    
    /**
     * 
     * Checks if given entity is correct and and it into the DB
     * 
     * @param ghost ghost we want to add to database
     * @throws IllegalArgumentException if entity itself or any of its attributes
     * is null or, in case of strings, empty. Also throws this exception in case the Ghost has
     * already assigned ID.
     */
    void create(Ghost ghost);
    
    
    /**
     *  Checks if given Ghost is correct and present in the DB and updates it in the DB.
     * 
     * @param ghost the ghost we want to update
     * @throws IllegalArgumentException if entity itself or any of its attributes
     *  is null or, in case of strings, empty.
     */
    void update(Ghost ghost);
    
    
    /**
     * Checks if given Ghost is correct and present is the database, if so, this
     * Ghost will be removed.
     *
     * @param ghost the ghost to be removed
     * @throws IllegalArgumentException if entity itself or any of its attributes
     * is null or, in case of strings, empty.
     */
    void remove(Ghost ghost);
    
    
    /**
     * Returns a Ghost from the DB based on its ID. If there is no Ghost with
     * such ID, null is returned.
     *
     * @param id id of a Ghost we want to search in the DB
     * @return null if there is no Ghost with given ID, Ghost otherwise
     * @throws IllegalArgumentException if id is null or < 0
     */
    Ghost get(Long id);
    
    
    /**
     * Returns list of all ghosts in the DB. If there are no ghosts, empty list
     * is returned
     *
     * @return List of all ghosts Empty list of there are no ghosts. 
     */
    List<Ghost> findAll();
    
    
    /**
     * Returns list of all ghosts filtered by their name, which is given as parametr.
     *
     * @param name name (or part of the name) of the ghost/s we want to search for
     * @return List of all ghosts which name contains given String, empty list if no Ghost contains it.
     * @throws IllegalArgumentException if given string is either null or empty
     */
    List<Ghost> findByName(String name);
    
    
    /**
     * Returns list of all ghosts filtered by house they are in, which is given as parametr.
     *
     * @param house house where ghost/s is
     * @return List of all ghosts filtered by house they are in
     * @throws IllegalArgumentException if given parametr or any of its attributes
     * is null or, in case of strings, empty. Also throws this exception in case the Ghost has
     * already assigned ID.
     */
    List<Ghost> findByHouse(House house);
    
    
    /**
     * Returns list of all ghosts filtered by it's level, which is given as parametr.
     *
     * @param level level of ghost
     * @return List of all ghosts filtered by their level
     * @throws IllegalArgumentException if level is null or < 0
     */
    List<Ghost> findByLevel(Integer level);
    
    
    /**
     * Returns list of all ghosts filtered by it's ability type, which is given as parametr.
     *
     * @param type ability type of ghost
     * @return List of all ghosts filtered by their ability type
     * @throws IllegalArgumentException if type is null
     */
    List<Ghost> findByType(AbilityType type);
    
}
